<template>
	<view>
		<view class="wrap">
				<u-swiper :list="list" mode="dot" keyName="image" height="200px"></u-swiper>
			</view>
    <!-- 导航区域 -->
    <view class="nav">
      <view class="nav_item" v-for="(item2,index) in navs" :key="index" @click="navItemClick(item2.path)">
        <view :class="item2.icon"></view>
        <text>{{item2.title}}</text>
      </view>
    </view>
    <!-- 推荐商品 -->
    <view class="hot_goods">
      <view class="tit">
        推&nbsp;&nbsp;荐&nbsp;&nbsp;商&nbsp;&nbsp;品
      </view>
      <!-- 商品列表 -->
      <view class="goods_list">
        <view class="goods_item" v-for="(item,index) in goods" :key="index">
          <image :src="item.image"></image>
          <view class="price">
            <text>{{item.price1}}</text>
            <text>{{item.price2}}</text>
          </view>
          <view class="name">
            {{item.name}}
          </view>
        </view>
      </view>
    </view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
        goods: [
          {
            image: '../../static/lhp.jpg',
            price2: '￥2195',
            price1: '￥0',
            name: '李昊鹏(石河子)渣男一号'
          },
          {
            image: '../../static/lhp.jpg',
            price2: '￥2195',
            price1: '￥0',
            name: '李昊鹏(石河子)渣男一号'
          },
          {
            image: '../../static/lhp.jpg',
            price2: '￥2195',
            price1: '￥0',
            name: '李昊鹏(石河子)渣男一号'
          },
          {
            image: '../../static/lhp.jpg',
            price2: '￥2195',
            price1: '￥0',
            name: '李昊鹏(石河子)渣男一号'
          },
          {
            image: '../../static/lhp.jpg',
            price2: '￥2195',
            price1: '￥0',
            name: '李昊鹏(石河子)渣男一号'
          },
          {
            image: '../../static/lhp.jpg',
            price2: '￥2195',
            price1: '￥0',
            name: '李昊鹏(石河子)渣男一号'
          },
          {
            image: '../../static/lhp.jpg',
            price2: '￥2195',
            price1: '￥0',
            name: '李昊鹏(石河子)渣男一号'
          },
          {
            image: '../../static/lhp.jpg',
            price2: '￥2195',
            price1: '￥0',
            name: '李昊鹏(石河子)渣男一号'
          },
          {
            image: '../../static/lhp.jpg',
            price2: '￥2195',
            price1: '￥0',
            name: '李昊鹏(石河子)渣男一号'
          },
          {
            image: '../../static/lhp.jpg',
            price2: '￥2195',
            price1: '￥0',
            name: '李昊鹏(石河子)渣男一号'
          }
        ],
				list: [
          {
						image: '/static/A.jpg',
					},
					{
						image: '/static/B.jpg',
					},
					{
						image: '/static/C.jpg',
					}
				],
        navs: [
          {
            icon: 'iconfont icon-ziyuan',
            title: '智科商城',
            path: '/pages/goods/goods'
          },
          {
            icon: 'iconfont icon-guanyuwomen',
            title: '联系我们',
            path: '/pages/contact/contact'
          },
          {
            icon: 'iconfont icon-tupian',
            title: '社区图片',
            path: '/pages/pics/pics'
          },
          {
            icon: 'iconfont icon-shipin',
            title: '学习视频',
            path: '/pages/videos/videos'
          }
        ]
      }
		},
		onLoad() {

		},
		methods: {
      // 导航点击的函数
      navItemClick(url) {
        uni.navigateTo({
          url
        })
      }
		},
    onPullDownRefresh() {
    		setTimeout(function () {
    			uni.stopPullDownRefresh();
    		}, 1000);
    }
	}
</script>

<style lang="scss" scoped>
  .wrap{
    padding: 10upx;
  }
  .nav{
    display: flex;
    .nav_item{
      width: 25%;
      text-align: center;
      view{
        width: 120rpx;
        height: 120rpx;
        background: #00ff7f;
        border-radius: 50%;
        margin: 10px auto;
        line-height: 120rpx;
        color: #ffffff;
        font-size: 50rpx;
      }
      text{
        font-size: 30rpx;
      }
    }
  }
  .hot_goods{
    text-align: center;
    overflow: hidden;
    margin: 10px;
    .tit{
      height: 50px;
      line-height: 50px;
      color: #000000;
      background: #eeeeee;
      margin: 7rpx 0;
      font-weight: bold;
    }
  }
  .goods_list{
    padding: 0 15rpx;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    .goods_item{
      background: #ffffff;
      width: 335rpx;
      margin: 10rpx 0;
      padding: 15rpx;
      box-sizing: border-box;
      image{
        width: 80%;
        height: 150px;
        margin: 0 auto;
      }
      .price{
        color: #ff0000;
        font-size: 30rpx;
        text:nth-child(2){
          color: #cccccc;
          font-size: 28rpx;
          margin-left: 17rpx;
          text-decoration: line-through;
        }
      }
      .name{
        font-size: 28rpx;
        line-height: 50rpx;
        padding-bottom: 15rpx;
        padding-top: 15rpx;
      }
    }
  }
</style>
